//
//  HBBondListHeaderView.m
//  HuoBao
//
//  Created by chaiyanan on 15/12/3.
//  Copyright © 2015年 jinxin. All rights reserved.
//

#import "HBBondListHeaderView.h"

@interface HBBondListHeaderView ()

@property (nonatomic, strong) NSArray *subAry;

@end

@implementation HBBondListHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.backgroundColor = [LCCommon getColor:@"e1e1e1"];
        self.subAry = @[@"借款人",@"借款金额",@"借款日期"];
        [self createCustomView];
        
    }
    return self;
}

- (void)createCustomView
{
    float x = 5;
    float av = (SCREEN_WIDTH-10)/3;
    
    for (int i=0;i<self.subAry.count;i++)
    {
        UIFont *font = [UIFont systemFontOfSize:12.0f];
        
        NSTextAlignment textAlignment = NSTextAlignmentCenter;
        
        CGRect frame = CGRectMake(x+i*av, 0, av, 30);
        
        
        UIColor *color = [LCCommon getColor:@"666666"];
        
        [self createLableWithTextColor:color font:font text:self.subAry[i] textAlignment:textAlignment frame:frame superView:self];
        
    }
    
    [self createSepratorLineWithFrame:CGRectMake(15, 31-1/([UIScreen mainScreen].scale), SCREEN_WIDTH-30, 1/([UIScreen mainScreen].scale)) backgroundColor:[LCCommon getColor:@"cccccc"] superView:self];
}

- (UILabel *)createLableWithTextColor:(UIColor *)color font:(UIFont *)font text:(NSString *)text textAlignment:(NSTextAlignment)textAlignment frame:(CGRect)frame superView:(UIView *)superView
{
    UILabel *lable = [[UILabel alloc]initWithFrame:frame];
    lable.textColor = color;
    lable.font = font;
    lable.text = text;
    lable.textAlignment = textAlignment;
    [superView addSubview:lable];
    return lable;
}

- (UIView *)createSepratorLineWithFrame:(CGRect)frame backgroundColor:(UIColor *)bgColor superView:(UIView *)superView
{
    UIView *sepratorLine = [[UIView alloc]initWithFrame:frame];
    sepratorLine.backgroundColor = bgColor;
    [superView addSubview:sepratorLine];
    return sepratorLine;
}


@end
